<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('menus', function (Blueprint $table) {
            $table->id();
            $table->string('title')->nullable()->comment('菜单名称');
            $table->string('path')->nullable()->comment('路由地址');
            $table->string('icon')->nullable()->comment('菜单图标');
            $table->string('type')->nullable()->comment('菜单类型');
            $table->string('perm')->nullable()->comment('按钮权限');
            $table->tinyInteger('alwaysShow')->default(0)->comment('根目录始终显示0:false/1:true');
            $table->tinyInteger('keepAlive')->default(0)->comment('是否缓存0:false/1:true');
            $table->string('component')->nullable()->comment('组件地址');
            $table->string('redirect')->nullable()->comment('重定向');
            $table->tinyInteger('hidden')->default(1)->comment('0:false/1:true');
            $table->unsignedInteger('order')->nullable()->comment('排序');
            $table->foreignId('menus_id')->nullable()->constrained('menus', 'id', 'mens_id')->comment('菜单父ID');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('menus');
    }
};
